import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class LoginCheckServlet extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String userName = request.getParameter("username");
        String userPwd = request.getParameter("userpwd");
        String info = "";


        if( ("liyibo".equals(userName)) && ("18210220212".equals(userPwd)) ){
            info = "登录成功！\n" + "欢迎你，" + userName ;
        }else{
            if((!"liyibo".equals(userName)) && (!"18210220212".equals(userPwd))){
                info = "用户名和密码都不正确！";
            }else if(!"liyibo".equals(userName)){
                info = "没有查找到 " + userName + " 这个用户！";
            }else if(!"18210220212".equals(userPwd)){
                info =  userName + " 输入的密码错误！";
            }
        }

        request.setAttribute("outputMessage", info);
        request.getRequestDispatcher("/info.jsp").forward(request,response);

    }
}